<script setup>
import { onLaunch } from '@dcloudio/uni-app'
import { get, post } from './request/request';

onLaunch((options) => {

  uni.login({
    provider: 'weixin',
    success: function (loginRes) {
      post('/user_login', { jsCode: loginRes.code }, { 'content-type': 'application/x-www-form-urlencoded' }).then(res => {
        console.log('/user_login', res);
        uni.setStorageSync('sessionKey', res.data.sessionKey);
        uni.setStorageSync('auth', res.data.auth)
      })
    },
  })

})
</script>
<style lang="scss">
@import '@tuniao/tn-style/dist/uniapp/index.css';

page {
  background: #f5f6f7;
}
</style>